from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter
from meiduo_admin.system import permission_views
from meiduo_admin.good import brand_views
from meiduo_admin.good import channel_types_views
from meiduo_admin.good import goods_category_views
from meiduo_admin.good import goods_channels_views
from meiduo_admin.home import views
from meiduo_admin.user import user_views
from meiduo_admin.good import sku_views,spu_views,spec_views,spec_options_view,sku_images_views
from meiduo_admin.order import order_views
from meiduo_admin.system import group_permission_views
from meiduo_admin.system import admin_permission_views
urlpatterns = [
    #1,home
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', views.UserTotalCountView.as_view()),
    url(r'^statistical/day_increment/$', views.UserIncrementCountView.as_view()),
    url(r'^statistical/day_active/$', views.UserDayActiveCountView.as_view()),
    url(r'^statistical/day_orders/$', views.UserDayOrderCountView.as_view()),
    url(r'^statistical/month_increment/$', views.UserMonthIncreamentCountView.as_view()),
    url(r'^statistical/goods_day_views/$', views.UserGoodsVisitCountView.as_view()),

    #2,user
    url(r'^users/$',user_views.UserView.as_view()),

    #3,sku
    url(r'^skus/categories/$',sku_views.SKUCategoryView.as_view()),
    url(r'^goods/simple/$',sku_views.SKUGoodSimpleView.as_view()),
    # spu品牌
    url(r'^goods/(?P<spu_id>\d+)/specs/$',sku_views.SKUGoodsSpecsView.as_view()),
url(r'^goods/brands/simple/$',spu_views.SPUBrandSimpleView.as_view()),
    # spu 一级分类
url(r'^goods/channel/categories/$',spu_views.SPUCategoryView.as_view()),
    # spu 获取二级和三级分类
url(r'^goods/channel/categories/(?P<category_id>\d+)/$',spu_views.SPUCategorySubView.as_view()),
url(r'^goods/images/$',spu_views.SPUImageUploadView.as_view()),




    #6
    url(r'^goods/specs/simple/$',spec_options_view.OptionSpecView.as_view()),

    #  所属分组
    url(r'^goods/channel_types/$',channel_types_views.GoodsChanneTypelView.as_view()),

    # 所属一级分类
    url(r'^goods/categories/$',goods_category_views.GoodCategoryView.as_view()),


    url(r'^skus/simple/$',sku_images_views.AddSKUImageViewSet.as_view()),

    url(r'^permission/content_types/$',permission_views.PermissionContentTypeView.as_view()),

    url(r'^permission/simple/$', group_permission_views.PermissionSimpleView.as_view()),


    url(r'^permission/groups/simple/$', admin_permission_views.GroupPermissionView.as_view()),
]

# # goods/channel_types/
# router = DefaultRouter()
# router.register(r'goods/channel_types',brand_views.BrandlView,base_name="channel_types")
# urlpatterns += router.urls

# 11./permission/admins/
router = DefaultRouter()
router.register(r'permission/admins',admin_permission_views.AdminPermissionViewSet,base_name='admins')
urlpatterns += router.urls

#10,/permission/groups/
router = DefaultRouter()
router.register(r'permission/groups',group_permission_views.GroupPermissionViewSet,base_name="groups")
urlpatterns += router.urls


# permission/perms/
router = DefaultRouter()
router.register(r'permission/perms',permission_views.PermissionlView,base_name="PermissionlView")
urlpatterns += router.urls



# goods/brands
router = DefaultRouter()
router.register(r'goods/brands',brand_views.BrandlView,base_name="brands")
urlpatterns += router.urls



# goods_channel
router = DefaultRouter()
router.register(r'goods/channels',goods_channels_views.GoodsChannelView,base_name="channels")
urlpatterns += router.urls


# 8 ,orders
router = DefaultRouter()
router.register(r'orders',order_views.OrderViewSet,base_name="orders")
urlpatterns += router.urls



# 7. skus/images/

router = DefaultRouter()
router.register(r'skus/images',sku_images_views.SKUImageViewSet,base_name="images")
urlpatterns += router.urls

# 6,/specs/options
router = DefaultRouter()
router.register(r'specs/options',spec_options_view.SpecOptionsViewset,base_name='options')
urlpatterns += router.urls

# 5 /goods/specs/
router = DefaultRouter()
router.register(r'goods/specs',spec_views.SpecViewset,base_name='spec')
urlpatterns += router.urls
# 4,SPU
router = DefaultRouter()
router.register(r'goods',spu_views.SPUViewSet,base_name="goods")
urlpatterns += router.urls



#3,sku
router = DefaultRouter()
router.register(r'skus',sku_views.SKUViewSet,base_name="skus")
urlpatterns += router.urls
